package com.good.cm.controller;

import com.good.cm.model.ResultInfo;
import com.good.cm.service.PatientService;
import com.good.cm.vo.TriagePatient;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Controller
public class PatientController {

    @Resource
    private PatientService patientService;

    /**
     * 添加与更新
     * @param triagePatient
     * @return
     */
    @ResponseBody
    @PostMapping("patient/addPatient")
    public ResultInfo addPatient(@RequestBody TriagePatient triagePatient){
    //添加失败原因，日期传入格式不对，导致反序列化失败
        return patientService.addPatient(triagePatient);
    }

    /**
     * 通过pvid获取患者信息系
     * @param pvid
     * @return
     */
    @ResponseBody
    @GetMapping("patient/getPatientByPvid")
    public  ResultInfo getPatient(String pvid){
        return patientService.getPatient(pvid);
    }

    /**
     * 删除患者信息
     * @param triagePatient
     * @return
     */
    @ResponseBody
    @PostMapping("patient/deletePatient")
    public ResultInfo deletePatient(@RequestBody TriagePatient triagePatient){
        //添加失败原因，日期传入格式不对，导致反序列化失败
        return patientService.deletePatient(triagePatient);
    }
}
